<?php
class BaseAction extends Action {
	public function _initialize() {
		//管理员可操作的模块
		if ( !service('Passport')->isLoggedPartner() ) {
			$this->redirect( 'shanghu://Public/login' );
			exit;
		}
		
		//管理员能使用的模块
		$admin_module = array('Index','Coupon','Goods','Statis','Subsh');
		//验证员能使用的模块
		$check_module = array('Check');
		
		if($_SESSION['qp_role']=='admin'){
			if(!in_array(MODULE_NAME,$admin_module)){
				$this->error('无权操作');
			}
			$nav_show_module=$admin_module;
		}else{
			if($_SESSION['qp_role']=='checker'){
				if(!in_array(MODULE_NAME,$check_module)){
					$this->error('无权操作');
				}
			}else{
				$this->error('用户角色错误');
			}
			$nav_show_module=$check_module;
		}
		//dump($nav_show_module);
		$partner = unserialize($_SESSION['partnerInfo']);
		$this->assign('nav_show_module',$nav_show_module);
		$this->assign('partner',$partner);
	}
		
	public function getPartnerInfo($pid){
		$map['id']		 = $pid;
		$partners = service('Brand')->select4User($map,"*",1);
		return $partners[0];
	}
	
	/**条件搜索,将搜索条件变量加入到模版中.
	 **/
	protected function assignRequestParams(){
		unset($_REQUEST['__hash__']);
		unset($_REQUEST['pno']);
		unset($_REQUEST['goPageFun']);
		$this->assign($_REQUEST);
	}
}